﻿<%@ Page Language="C#" %>
<%
    string overlineid = Request.Params["overlineid"];
    string startorder = Request.Params["startorder"];
    string endorder = Request.Params["endtower"];
    int overlineidint;
    if (overlineid == null || overlineid == "" || !int.TryParse(overlineid,out overlineidint))
    {
        overlineid = "181";
        startorder = "0";
        endorder = "1";
    }
    string title = "架空线立面分析";
    System.Data.DataTable dt = null;
    
    string sql = "select t2.linename as linename, t.wireid as wireid,t.starttowername,t.nodedist as nodedist,t1.elevation as elevation from tab_wire t,tab_tower t1, tab_overline t2 where t.ordernum between  " + startorder + " and " + endorder + " and t2.overlineid = t.belongline and t.starttower = t1.towerid and t.BELONGLINE=" + overlineid + " ORDER BY t.ORDERNUM";
    Maticsoft.DBUtility.DbHelper dbhelper = new Maticsoft.DBUtility.DbHelper();
    dt = dbhelper.ExecuteDataTable(dbhelper.GetSqlStringCommond(sql));        
 %>
<chart caption='架空线立面分析' yAxisName='高度(米)' xAxisName='长度(米)' baseFontSize='12'  bgColor='F7F7F7, E9E9E9' numVDivLines='10' divLineAlpha='30'  labelPadding ='10' yAxisValuesPadding ='10' showValues='1' rotateValues='1' valuePosition='auto'>
        <categories>
        <category label='0' />
        <%        
                    int totallength = 0;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        double length = 0;
                        double.TryParse(dt.Rows[i]["nodedist"].ToString(),out length);

                        for (int j = totallength + 10; j <= totallength + length - 10; j += 10)
                        {
                        %><category label='<%=j %>' /><%
                        }
                        totallength += (int)length;                    
                    }                    
                     %></categories>

        <dataset seriesName='<%=dt.Rows[0]["linename"] %>' color='A66EDD' renderAs="Line">
        <%
                    totallength = 0;                      
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        double length = 0;
                        double.TryParse(dt.Rows[i]["nodedist"].ToString(),out length);
                        double height = 0;
                        if(double.TryParse(dt.Rows[i]["elevation"].ToString(), out height)){
                        }
                        height += 40;         
                        double height2 = 0;
                        if (i != dt.Rows.Count-1)
                        {
                            if (double.TryParse(dt.Rows[i + 1]["elevation"].ToString(), out height2)) { }

                        }
                        height2 += 40;
                        %><set value='<%=height %>' showValue='1' link='javascript:function a(){document.getElementById("ContFrame").src="../Public/CommonPage.aspx?table=TAB_WIRE&tabsysid=36&initWhere=wireid in (<%=dt.Rows[i]["wireid"] %>)";}a();' displayValue='<%=dt.Rows[i]["starttowername"].ToString() %>' showToolTip='0' toolText='<%=dt.Rows[i]["starttowername"].ToString() %>' />
                        <%
                        for (int j = totallength + 10; j <= totallength + length - 10; j += 10)
                        {
                            double heightc =height - Math.Sqrt( 5 - Math.Abs(5 - (j - totallength) * 10 / length)) + (height2 - height) * (j - totallength) / length;
                        %><set value='<%=heightc %>' showValue='0' toolText='<%=dt.Rows[i]["starttowername"].ToString() %>' anchorAlpha='0' />
                        <%
                        }
                        totallength += (int)length;                    
                    }                      
                %></dataset>
        <dataset seriesName='杆塔' drawAnchors='0' color='006BD00' renderAs="Area"><%
                    totallength = 0;                      
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        double length = 0;
                        double.TryParse(dt.Rows[i]["nodedist"].ToString(),out length);
                        double height = 0;
                        double.TryParse(dt.Rows[i]["elevation"].ToString(),out height);
                        double height2 = 0;
                        if (i != dt.Rows.Count - 1)
                        {
                            double.TryParse(dt.Rows[i + 1]["elevation"].ToString(),out height2);
                        }
                        %><set value='<%=height+40 %>'   showValue='0' toolText=''  anchorAlpha='0'/>
                        <%
                        for (int j = totallength + 10; j <= totallength + length - 10; j += 10)
                        {
                            double heightc = height + (height2 - height) * (j - totallength) / length;
                        %><set value='<%=heightc %>'  showValue='0' toolText=' '  anchorAlpha='0' />
                        <%
                        }
                        totallength += (int)length;                    
                    }                      
                %></dataset>           
        <dataset seriesName='地面线' color='F6BD0F' drawAnchors='0' alpha='100' renderAs="Area"><%
                    totallength = 0;                      
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        double length = 0;
                        double.TryParse(dt.Rows[i]["nodedist"].ToString(),out length);
                        double height = 0;
                        double.TryParse(dt.Rows[i]["elevation"].ToString(),out height);
                        double height2 = 0;
                        if (i != dt.Rows.Count - 1)
                        {
                            double.TryParse(dt.Rows[i + 1]["elevation"].ToString(),out height2);
                        }
                        %><set value='<%=height %>' showValue='0' showToolTip='0' toolText=' '/>
                        <%
                        for (int j = totallength + 10; j <= totallength + length - 10; j += 10)
                        {
                            double heightc = height + (height2 - height) * (j - totallength) / length;
                        %><set value='<%=heightc %>' showValue='0'  showToolTip='0' toolText=' ' />
                        <%
                        }
                        totallength += (int)length;                    
                    }                      
                %></dataset>     
</chart>